import { get, post } from './http'

//  登录请求 

/** 
 * 登录请求接口封装，对应post请求
 * url [请求的url地址]  
 * @param {Object} params [请求时携带的参数] 
 */
export const getLogin = (params?: any) => post('/user/login', params)


/** 
 * 首页轮播图接口封装，对应get 请求
 * url [请求的url地址]   
 * @param {Object} params [请求时携带的参数] 
 */

// 获取轮播图 
export const getBanner = (params?: any) => get('/banner/list', params)

// 获取商品列表
export const getGoodsList = (params?: any) => get('/pro/recommendlist', params)



// 获取秒杀商品列表 
export const getSeckillGoodsList = (params?: any) => get('/pro/seckilllist', params)



// 获取购物车数据 

export const getCartList = (params?: any) => post('/cart/list', params)




// 定义这一层的原因是接口复用的时候比较方便




// 加入购物车


export const cartAdd = (params?: any) => post("/cart/add", params)





// 购物车删除商品

export const cartRemove = (params?: any) => post("/cart/remove", params)
// 更新购物车商品数量
export const cartUpdatenum = (params?: any) => post("/cart/updatenum", params)
// 更新单个商品选中状态
export const cartUpdateSelectone = (params?: any) => post("/cart/selectone", params)

// 更新全部商品选中状态
export const cartUpdateSelectall = (params?: any) => post("/cart/selectall", params)

// 猜你喜欢列表数据
export const cartGetRecommendlist = (params?: any) => get("/pro/recommendlist", { params })



//  获取商品详情 

export const getGoodsDetail = (params?: any) => get(`/pro/detail/${params}`)


//  地址接口  




// 获取地址列表
export const getListAddress = (params?: any) => get('/address/list', params)
// 删除地址

export const getDeleteAddress = (params?: any) => post('/address/delete', params)
// 更新地址
export const getUpdateAddress = (params?: any) => post('/address/update', params)
// 查询默认地址
export const getQueryAddress = (params?: any) => post('/address/defaultAddress', params)
// 添加地址
export const getAddAddress = (params?: any) => post('/address/add', params)








